#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QNetworkReply>
#include <QSystemTrayIcon>
#include "ui_mainwindow.h"

const QString g_api = "https://www.google.com/accounts/ClientLogin";
const QString g_auth = "Auth";
const QString g_content_type = "application/x-www-form-urlencoded";
const QString g_auth_header = "Authorization";
const QString g_auth_value = "GoogleLogin auth=%1";
const QString g_contacts_url = "http://www.google.com/m8/feeds/contacts/%1/full";

class MainWindow : public QMainWindow, Ui::MainWindow
{
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void slotError(QNetworkReply::NetworkError);
    void loadSettings();
    void showAbout();
    void showSettings();
    void updateContactList();
    void replyFinished(QNetworkReply*);
    void iconActivated(QSystemTrayIcon::ActivationReason);
    void sendMail();
private:
    QNetworkAccessManager *manager;
    QNetworkReply* reply;
    QMap<QString, QString> contacts;
    QString auth;
    QString open;
    QString email;
    QString password;
    QSystemTrayIcon* tray;
    QString error;
};

#endif // MAINWINDOW_H
